<template>
  <div>
    <div id="chart1"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
import pie from "./options/pie";
import { chartGet } from "../../api/product";
export default {
  async mounted() {
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById("chart1"));
    // 请求后端数据
    let res = await chartGet();
    let { rose } = res.data.results[0];
    pie.series[0].data = rose;
    // 绘制图表
    myChart.setOption(pie);
  },
};
</script>

<style lang="scss" scoped>
#chart1 {
  height: 700px;
}
</style>
